package com.own.business.push.persistence.mysql.entity.bo;

import com.own.business.push.persistence.mysql.entity.po.PushRegistration;
import com.own.component.common.base.entity.BaseBo;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * PushRegistrationBo
 *
 * @author chenxueli
 * @date 2023-11-16 14:14:41
 */
@Schema(title = "推送注册" + ConstantBeanSuffix.BO)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class PushRegistrationBo extends BaseBo<PushRegistration> implements Serializable {

    /**
     * 用户id
     */
    private Long userId;

    /**
     * 注册id
     */
    private String regId;

    /**
     * 模块
     */
    private String module;

    /**
     * 转持久化对象
     *
     * @param entity 原持久化对象
     * @return 持久化对象
     */
    @Override
    public PushRegistration toPo(PushRegistration entity) {
        if (entity == null) {
            entity = new PushRegistration();
        }
        entity.setFkUserId(this.userId);
        entity.setRegId(this.regId);
        entity.setModule(this.module);
        return super.toPo(entity);
    }

}

